package com.dakor.catalog.persistence.dao.impl;

import com.dakor.catalog.persistence.dao.AbstractDao;
import com.dakor.catalog.persistence.dao.IFilmDao;
import com.dakor.catalog.persistence.entity.Film;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Realization of {@link com.dakor.catalog.persistence.dao.IFilmDao}.
 *
 * @author Korobeynikov Dmitry
 * @version 1.0
 */
@Repository
@Transactional
public class FilmDao extends AbstractDao implements IFilmDao {

    @Override
    public void insert(Film film) {
        getHibernateTemplate().save(film);
    }

    @Override
    public List<Film> selectAll() {
        return getHibernateTemplate().loadAll(Film.class);
    }

    @Override
    public void clear() {
        getHibernateTemplate().clear();
    }

}
